package com.itheima2;

import java.io.File;

public class Work07 {
    public static void main(String[] args) {
        File file = new File("D:\\itcast");
        deleteDir(file);

    }
    public static void deleteDir(File  dir){
        File[] files = dir.listFiles();
        if (files!=null){
     for (File file : files) {
         if (file.isFile()){
             file.delete();
         }else {
             deleteDir(file);
         }
     }
 }
            dir.delete();

    }
}
